clear;
addpath('result/');
dataSets = {'wdbc','vehicle','texture','spectf','australian','clean1','diabetes','echocardiogram','german','heart','optdigits','sat',...
    'heart-statlog','house','house-votes','ionosphere','isolet','krvskp','liverDisorders'};
%dataSets = {'echocardiogram'};
 
candidates = {'TSVM','GSSL'};

N = 10;

results = cell(numel(dataSets), N);
cors = cell(numel(dataSets),N);
sels = cell(numel(dataSets), N);
kfcvcors = cell(numel(dataSets),N);

parpool(2);
for i = 1:length(dataSets)
    parfor j = 1:N
        fprintf('DATASET:%s %d\n', dataSets{i}, j);
        results{i, j} = ActiveModelSelection(dataSets{i}, candidates, 20, 20, 1, 1);
    end
end
delete(gcp); 


for i = 1:length(dataSets)
    for j = 1:N
        cors{i, j} = results{i, j}.correct;
        sels{i, j} = results{i, j}.model;
        kfcvcors{i, j} = results{i, j}.kfcvCorrect;
    end
end

save(['result/random_test1.mat'], 'cors', 'sels', 'kfcvcors');